<script type="text/javascript" src="<?php echo site_url();?>addons/themes/ranking/js/helper.js"> </script>
<?php echo form_open('admin/dataman/content_update');?>

<script type="text/javascript">
<!--
	function search_item(){
		var keyWord= jQuery('#keyword').val();
		var type= jQuery("input:radio:checked").val();
		window.location = BASE_URI+'admin/dataman/content?keyword='+urlencode(keyWord)+'&type='+type;
	}
//-->
</script>
<?php 
	$keyWord= (isset($_GET['keyword'])) ? $_GET['keyword']: '';
	$type= (isset($_GET['type'])) ? $_GET['type']: 'name';
	$type_arr = array('id','name','region','city','created_user','modified_user');
	
	foreach ($type_arr as $t){
		if($type == $t){
			$$t= 'checked="checked"';
		}else{
			$$t= '';
		}
	}
?>
	<h3><?php echo lang('dataman.content'); ?></h3>
	<div id="search">
		<input type="text" size="50" maxlength="50" name="keyword" id="keyword" value="<?php echo $keyWord;?>"/> &nbsp;&nbsp; 
		<input type="button" value= "<?php echo lang('dataman.search');?>" onclick= "search_item();" />
		<br/>
		<input type="radio" name="condition" value="id" <?php echo $id;?> /><?php echo lang('dataman.content.id'); ?> &nbsp;&nbsp;&nbsp;
		<input type="radio" name="condition" value="name" <?php echo $name;?> /><?php echo lang('dataman.content.name'); ?>&nbsp;&nbsp;&nbsp;
		<input type="radio" name="condition" value="region" <?php echo $region;?> /><?php echo lang('dataman.content.state'); ?>&nbsp;&nbsp;&nbsp;
		<input type="radio" name="condition" value="city" <?php echo $city;?> /><?php echo lang('dataman.content.city'); ?>&nbsp;&nbsp;&nbsp;
		<input type="radio" name="condition" value="created_user" <?php echo $created_user;?> /><?php echo lang('dataman.content.who_created'); ?>&nbsp;&nbsp;&nbsp;
		<input type="radio" name="condition" value="modified_user" <?php echo $modified_user;?> /><?php echo lang('dataman.content.who_modified'); ?>
	</div>
	<div id="action"><?php $this->load->view('admin/partials/buttons', array('buttons' => array('add'))); ?></div>
	
	<table border="0" class="table-list">
		<thead>
			<tr>
				<th><?php echo lang('dataman.content.id'); ?></th>
				<th><?php echo lang('dataman.content.name'); ?></th>
				<th><?php echo lang('dataman.content.state'); ?></th>
				<th><?php echo lang('dataman.content.city'); ?></th>
				<th><?php echo lang('dataman.content.who_created'); ?></th>
				<th><?php echo lang('dataman.content.created_date'); ?></th>
				<th><?php echo lang('dataman.content.who_modified'); ?></th>
				<th><?php echo lang('dataman.content.last_modified_date'); ?></th>
				<th><?php echo lang('dataman.content.top_stand'); ?></th>
				<th><?php echo lang('dataman.edit'); ?></th>
				<th><?php echo lang('dataman.delete'); ?></th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="11">
					<div class="inner"><?php echo $pagination; ?></div>
				</td>
			</tr>
		</tfoot>
		<tbody>
			<?php foreach( $contents as $content ): ?>
			<tr>
				<td><?php echo $content->id ?></td>
				<td><?php echo $content->name."<br />".$content->dish_name; ?></td>
				<td><?php echo $content->state_name; ?></td>
				<td><?php echo $content->city_name; ?></td>
				<td><?php echo $content->created_user; ?></td>
				<td><?php echo date('d/m/Y H:m:i',$content->created_time); ?></td>
				<td><?php echo $content->modified_user; ?></td>
				<td><?php echo date('d/m/Y H:m:i',$content->modified_time); ?></td>
				<td id="stand_<?php echo $content->id;?>">
					
					<?php 
						if($content->is_top_stand == 1){
							$checked= "checked='checked'";
						}else{
							$checked= "";
						}
					?>
					<input type="radio" name="stand" <?php echo $checked?> id="stand_<?php echo $content->id;?>" onclick="javascript:setTopstand(<?php echo $content->id;?>);" />
				</td>
				<td>
					<?php echo anchor('admin/dataman/content_edit_item/'. $content->id, 	lang('dataman.edit')); ?>
				</td>
				<td>
					<?php 
						echo anchor('admin/dataman/content_delete_item/'. $content->id, lang('dataman.delete'));//
					?>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
	
<?php echo form_close(); ?>